package com.sto.stoapp.db.manager;

import android.content.Context;

import com.sto.stoapp.db.StoDataBase;
import com.sto.stoapp.db.constant.RegionInfoConstant;
import com.sto.stoapp.db.constant.StoSiteCodeConstant;

public class SqlSelectTableManager extends StoDataBase {

	public SqlSelectTableManager(Context context) {
		super(context);

	}

	// 搜索员工全部数据
	public static final String SQL_STAFF_ALL = "select * from " + SALES_TABLE
			+ " where 1=1";
	// 搜索员工某一条数据
	public static final String SQL_STAFF_ONLY_LIKE = "select * from "
			+ SALES_TABLE + " where " + SALES_NUMBER + " like ? or "
			+ SALES_NAME + " like ? ";
	/**
	 * 搜索员工某一条数据
	 */
	public static final String SQL_STAFF_ONLY = "select * from " + SALES_TABLE
			+ " where " + SALES_NUMBER + "=?";

	// 搜索网点全部数据
	public static final String SQL_NETSITE_ALL = "select * from "
			+ SITE_CODE_FULL_TABLE + " where 1=1";
	// 搜索网点某一条数据
	public static final String SQL_NETSITE_ONLY_LIKE = "select * from "
			+ SITE_CODE_FULL_TABLE + " where " + SITE_CODE_NUMBER
			+ " like ? or " + SITE_CODE_NAME + " like ? ";
	// 搜索网点(下级部门)全部数据
	public static final String SQL_NETSITE_NEXT_DEPT_ALL = "select * from "
			+ SITE_CODE_FULL_TABLE + " where " + StoSiteCodeConstant.BACKUP1
			+ "=1";
	// 搜索网点(下级部门)某一条数据
	public static final String SQL_NETSITE_NEXT_DEPT_ONLY_LIKE = "select * from "
			+ SITE_CODE_FULL_TABLE
			+ " where ("
			+ SITE_CODE_NUMBER
			+ " like ? or "
			+ SITE_CODE_NAME
			+ " like ?) and "
			+ StoSiteCodeConstant.BACKUP1 + "=1";
	/**
	 * 搜索网点某一条数据
	 */
	public static final String SQL_NETSITE_ONLY = "select * from "
			+ SITE_CODE_FULL_TABLE + " where " + SITE_CODE_NUMBER + "=?";

	// 搜索下一站网点资料全部数据
	public static final String SQL_NEXT_NETSITE_ALL = "select b.site_code_number, b.site_code_name from "
			+ NEXT_SITE_CODE_TABLE
			+ " a, site_code_full_table b where a.site_code_name=b.site_code_number";
	// 搜索下一站网点资料某一条数据
	public static final String SQL_NEXT_NETSITE_ONLY_LIKE = "select b.site_code_number, b.site_code_name from "
			+ NEXT_SITE_CODE_TABLE
			+ " a, site_code_full_table b where a.site_code_name=b.site_code_number"
			+ " and a.site_code_name " + " like ?  ";

	/**
	 * 搜索下一站网点资料某一条数据
	 */
	public static final String SQL_NEXT_NETSITE_ONLY = "select * from "
			+ NEXT_SITE_CODE_TABLE + " where " + SITE_CODE_NUMBER + "=?";

	// 搜索省份全部数据(行政区域)
	public static final String SQL_REGION_INFO_ALL = "select * from "
			+ REGION_INFO_TABLE + " where " + RegionInfoConstant.LEVEL + "='2'";
	// 搜索省份某一条数据(行政区域)
	public static final String SQL_REGION_INFO_ONLY_LIKE = "select * from "
			+ REGION_INFO_TABLE + " where (" + CODE + " like ? or "
			+ RegionInfoConstant.NAME + " like ?) and "
			+ RegionInfoConstant.LEVEL + "='2'";
	/**
	 * 搜索某一条数据
	 */
	public static final String SQL_REGION_INFO_ONLY = "select * from "
			+ REGION_INFO_TABLE + " where " + CODE + "=?" + " and "
			+ RegionInfoConstant.LEVEL + "='2'";

	// 搜索订单打回原因全部数据
	public static final String SQL_ORDER_REASON_ALL = "select * from "
			+ ORDER_REASON_TABLE + " where 1=1";
	// 搜索订单打回原因某一条数据
	public static final String SQL_ORDER_REASON_ONLY = "select * from "
			+ ORDER_REASON_TABLE + " where " + ORDER_SERIAL_NUMBER
			+ " like ? or " + RECORD_CONTENT + " like ? ";

	// 搜索问题原因全部数据
	public static final String SQL_PROBLEM_ALL = "select * from "
			+ PROBLEM_TABLE + " where 1=1";
	// 搜索问题原因某一条数据
	public static final String SQL_PROBLEM_ONLY = "select * from "
			+ PROBLEM_TABLE + " where " + REASON_CODE + " like ? or "
			+ REASON_NAME + " like ? ";

	// 搜索服务点短信全部数据
	public static final String SQL_SERVER_SMS_ALL = "select * from "
			+ SERVER_SMS_DOWNLOAD_TABLE + " where 1=1";
	// 搜索服务点短信某一条数据
	public static final String SQL_SERVER_SMS_ONLY = "select * from "
			+ SERVER_SMS_DOWNLOAD_TABLE + " where " + SERVER_SMS_SITECODE
			+ " like ? ";

	// 搜索路由表的全部数据
	public static final String SQL_ROUTE_ALL = "select * from " + TAB_ROUTE
			+ " where 1=1";
	// 搜索路由表某一条数据
	public static final String SQL_ROUTE_ONLY = "select * from " + TAB_ROUTE
			+ " where " + ROUTE_CODE + " = ? ";

	// 搜索到包预报表的全部数据
	public static final String SQL_CAST_ALL = "select * from " + TAB_FORE_CAST
			+ " where 1=1";
	// 搜索到包预报表某一条数据
	public static final String SQL_CAST_ONLY = "select * from " + TAB_FORE_CAST
			+ " where " + CAST_BAR_CODE + " = ? ";

	// 搜索省
	public static final String SQL_REGION_PROVINCE_ALL = "select name from "
			+ REGION_INFO_TABLE + "  where " + RegionInfoConstant.LEVEL
			+ "='2'";
	// 搜索省(匹配)
	public static final String SQL_PROVINCE_LIKE = "select name from  region_info_table where"
			+ " name like ? and level='2";
	// 搜索市
	public static final String SQL_CITY_ALL = "select name from region_info_table  where parentName=?";
	// 搜索市(匹配)
	public static final String SQL_CITY_LIKE = "select name from  region_info_table where parentName=?"
			+ " and name like ?";
	// 搜索区
	public static final String SQL_DISTRICT_ALL = "select name from  region_info_table  where parentName=?";
	// 搜索区(匹配)
	public static final String SQL_DISTRICT_LIKE = "select name from  region_info_table where"
			+ " parentName=? and name like ?";

	// 搜索签收名
	public static final String SQL_SIGN_INFO_ALL = "select shortKey, nameValue from  table_sto_sign_info  where 1=1";
	// 搜索签收名(匹配)
	public static final String SQL_SIGN_INFO_LIKE = "select shortKey, nameValue from  table_sto_sign_info where"
			+ " shortKey like ?";

	// 搜索问题件原因
	public static final String SQL_CAUSE_INFO_ALL = "select type_code, type_name, reason_code, reason_name from  problem_table  where user_widget='A' or user_widget=? order by type_code";
	// 搜索问题件原因(代号匹配)
	public static final String SQL_CAUSE_INFO_ONLY = "select type_code, type_name, reason_code, reason_name from  problem_table where reason_code=? and (user_widget='A' or user_widget=?) order by type_code";

	// 清空网点全表全表
	public static final String SQL_NETSITE_CLEAR = "delete from "
			+ SITE_CODE_FULL_TABLE;
	// 清空员工表全表
	public static final String SQL_STAFF_CLEAR = "delete from " + SALES_TABLE;

	// 清空下一站网点全表
	public static final String SQL_NEXT_NETSITE_CLEAR = "delete from "
			+ NEXT_SITE_CODE_TABLE;
	// 清空省份全表
	public static final String SQL_PROVINCE_CLEAR = "delete from "
			+ REGION_INFO_TABLE;
	// 清空订单打回原因全表
	public static final String SQL_ORDER_REASON_CLEAR = "delete from "
			+ ORDER_REASON_TABLE;
	// 清空问题件原因全表
	public static final String SQL_PROBLEM_CLEAR = "delete from "
			+ PROBLEM_TABLE;
	// 清空路由表
	public static final String SQL_ROUTE_CLEAR = "delete from " + TAB_ROUTE;

	public static final String SQL_ORDER_VIEW = "select * from order_download_table";

}
